import React from 'react';
import { history  } from 'umi';
import { Row,Col ,Tag} from 'antd';
import '@/components/HistoryPop/index.less';
const index = (props) => {
    const {routerList=[],preventDefault,checkedIndex} = props;
    const goToRoute = ({path})=>{
      history.push({
        pathname:path,
        state:{
          noPush:true,
        }
      })
    }
    
    return (
    <Row>
      <Col span={24} className="history-pop">
        {
            routerList.map((item,ind)=><Tag key={item.name} className="my_tags" closable onClose={()=>preventDefault(item)}  color={checkedIndex==ind?'blue':''} onClick={()=>goToRoute(item)}>{item.title}</Tag>)
        }
      </Col>
    </Row>
    );
}
export default index;
